<?php
require '../../config.php';

if( isset($_POST['password'])
  && md5($_POST['password']) == 'e3ae81c5fc3667d09308b74598add30f' ){
  $_SESSION['admin'] = true;
  header('Location: ' . BASE_ADMIN);
  exit;
}

if( isset($_GET['out']) ){ // GET OUT! LOL
  unset($_SESSION['admin']);
}

?>
<!DOCTYPE HTML>
<html lang="en-US">
<head>
  <meta charset="UTF-8">
  <title>Iniciar sesión</title>
  <base href="<?php echo BASE_ADMIN ?>" />
  <link rel="stylesheet" type="text/css" href="css/bootstrap.css" />
</head>
<body>
  <div class="container" style="padding-top: 50px;">
    <h2>Panel de administración OFJ</h2>
    <h4 style="padding-top: 20px;">Iniciar sesión</h4>
    <form action="login/" method="post" enctype="application/x-www-form-urlencoded">
      <label for="">Contraseña:</label>
      <input type="password" name="password">
      <div class="form-actions">
        <button type="submit" class="btn btn-primary">Iniciar sesión</button>
      </div>
    </form>
  </div>
</body>
</html>